package com.zimu.example.config;


import com.blade.Blade;
import com.blade.event.BeanProcessor;
import com.blade.ioc.annotation.Bean;
import com.blade.jdbc.Base;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
/**
 * @author : zimu
 * @Date: 2018/7/20 00:32
 * @description :
 */
@Bean
@Slf4j
public class DbConfig implements BeanProcessor {

    @Override
    public void processor(Blade blade) {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/blade");
        config.setUsername("root");
        config.setPassword("Z1mu@hacking");
        config.addDataSourceProperty("cachePrepStmts", "true");
        config.addDataSourceProperty("prepStmtCacheSize", "250");
        config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");

//        HikariDataSource ds = new HikariDataSource(config);
//        Base.open(ds);
//        log.info("Database init success.");
    }
}
